<?php

/**
 * 项目自定义函数库
 *
 * @author heshun
 */
/* 转向到登录页面的专用函数 */
function redirect_to_login($url = '')
{
    if (empty($url) === true)
    {
        $url = 'http://' . DOMAIN;
        if ($GLOBALS['REQUEST_INFO']['uri'] != '/')
        {
            $url .= $GLOBALS['REQUEST_INFO']['uri'];
        }
    }

    $profile_domain = get_domain_name_by_app('profile', true);

    if ($url != $profile_domain . '/index.php' && $url != $profile_domain . '/' && $url != $profile_domain)
    {
        $url = $profile_domain . '/login.php?r=' . urlencode($url);
    }
    else
    {
        $url = $profile_domain . '/login.php';
    }

    esq_header('Location: ' . $url);

    exit;
}

?>
